//
//  UIButton+Extension.swift
//  ALSinaWeiBoSwift
//
//  Created by 柴瑞军 on 16/4/15.
//  Copyright © 2016年 myCompany. All rights reserved.
//

import UIKit
//分类使用
extension UIButton{
    convenience init(image:String,bgImage:String = "timeline_card_bottom_background", title:String ,fontSize:CGFloat = 12){
        self.init()
        //        设置按钮的背景图片
      setBackgroundImage(UIImage(named:bgImage), forState: UIControlState.Normal)
        
        setBackgroundImage(UIImage(named:"\(bgImage)_highlighted"), forState: UIControlState.Highlighted)
        //        设置按钮图片
        setImage(UIImage(named:image), forState: UIControlState.Normal)
        
        //        设置标题按钮
        setTitle(title, forState: UIControlState.Normal)
        // 设置文字大小和颜色
        setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)

    }

}